<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>获取一个数组的最后一个键值</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.array-key-first.html">« array_key_first</a></li>
      <li style="float: right;"><a href="function.array-keys.html">array_keys »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.array.html">数组 函数</a></li>
    <li>获取一个数组的最后一个键值</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.array-key-last" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">array_key_last</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.3.0, PHP 8)</p><p class="refpurpose"><span class="refname">array_key_last</span> &mdash; <span class="dc-title">获取一个数组的最后一个键值</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.array-key-last-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>array_key_last</strong></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter">$array</code></span>): <span class="type"><span class="type">int</span>|<span class="type">string</span>|<span class="type">null</span></span></div>

  <p class="para rdfs-comment">
   取得指定数组的 <code class="parameter">array</code>
   最后一个键值，不会影响到原数组的内部指针。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.array-key-last-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">array</code></dt>

    <dd>

     <p class="para">
      要操作的数组。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.array-key-last-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 <code class="parameter">array</code> 的最后一个键值（如果不为空），否则返回 <strong><code>null</code></strong>。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.array-key-last-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.array-key-first.html" class="function" rel="rdfs-seeAlso">array_key_first()</a> - 获取指定数组的第一个键</span></li>
   <li class="member"><span class="function"><a href="function.end.html" class="function" rel="rdfs-seeAlso">end()</a> - 将数组的内部指针指向最后一个单元</span></li>
  </ul>
 </div>


</div></div></div></body></html>